﻿// Auto Complete

$(document).ready(function () {
    $("#txtSearch").autocomplete({
        source: function (request, response) {
            $.ajax({
                type: "POST",
                delay: 500,
                url:  "/Public/Search.aspx/GetSearchTitle",
                data: "{'term':'" + request.term + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    var i = data.d;
                    response($.map(data.d, function (v, k) {
                        return { label: v, key: k };
                    }));
                }
            });
        }
    });
});